package com.ruoyi.miniapp.service.impl;

import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.miniapp.api.domain.MiniappDictType;
import com.ruoyi.miniapp.mapper.MiniappDictTypeMapper;
import com.ruoyi.miniapp.service.IMiniappDictTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 字典类型Service业务层处理
 *
 * @author ruoyi
 * @date 2023-09-16
 */
@Service
public class MiniappDictTypeServiceImpl implements IMiniappDictTypeService
{
    @Autowired
    private MiniappDictTypeMapper miniappDictTypeMapper;

    /**
     * 查询字典类型
     *
     * @param dictId 字典类型主键
     * @return 字典类型
     */
    @Override
    public MiniappDictType selectMiniappDictTypeByDictId(Long dictId)
    {
        return miniappDictTypeMapper.selectMiniappDictTypeByDictId(dictId);
    }

    /**
     * 查询字典类型列表
     *
     * @param miniappDictType 字典类型
     * @return 字典类型
     */
    @Override
    public List<MiniappDictType> selectMiniappDictTypeList(MiniappDictType miniappDictType)
    {
        return miniappDictTypeMapper.selectMiniappDictTypeList(miniappDictType);
    }

    /**
     * 新增字典类型
     *
     * @param miniappDictType 字典类型
     * @return 结果
     */
    @Override
    public int insertMiniappDictType(MiniappDictType miniappDictType)
    {
        miniappDictType.setCreateTime(DateUtils.getNowDate());
        return miniappDictTypeMapper.insertMiniappDictType(miniappDictType);
    }

    /**
     * 修改字典类型
     *
     * @param miniappDictType 字典类型
     * @return 结果
     */
    @Override
    public int updateMiniappDictType(MiniappDictType miniappDictType)
    {
        miniappDictType.setUpdateTime(DateUtils.getNowDate());
        return miniappDictTypeMapper.updateMiniappDictType(miniappDictType);
    }

    /**
     * 批量删除字典类型
     *
     * @param dictIds 需要删除的字典类型主键
     * @return 结果
     */
    @Override
    public int deleteMiniappDictTypeByDictIds(Long[] dictIds)
    {
        return miniappDictTypeMapper.deleteMiniappDictTypeByDictIds(dictIds);
    }

    /**
     * 删除字典类型信息
     *
     * @param dictId 字典类型主键
     * @return 结果
     */
    @Override
    public int deleteMiniappDictTypeByDictId(Long dictId)
    {
        return miniappDictTypeMapper.deleteMiniappDictTypeByDictId(dictId);
    }
}
